import { Column, Entity } from "typeorm";
import { BaseEntity } from "@/common/entities/base.entity";
import { FileType } from "@/common/enums/file.enum";
@Entity('files')
export class FileStorage extends BaseEntity {
  @Column({ comment: '原文件名' })
  originalName: string;

  @Column({ comment: '存储文件名', length: 255 })
  fileName: string;

  @Column({ comment: '完整存储路径', length: 500 })
  filePath: string;

  @Column({
    comment: '文件类型,决定文件存储的子目录',
    type: 'enum',
    enum: FileType,
    default: FileType.Other
  })
  fileType: FileType;

  @Column({ comment: 'MIME类型,用于下载时设置正确的Content-Type', nullable: true, length: 100 })
  mimeType: string;

  @Column({ comment: '文件大小,单位字节', type: 'bigint' })
  size: number;

  @Column({ comment: '文件元数据,不同类型文件有不同的metadata', type: 'json', nullable: true })
  metadata: any;
}
